
<meta charset="utf-8">
<div class="box" id="biz_pmpProject_detail_bugs_conatainer">
	<div class="box-header with-border">
		<form id="pmpProjectTaskSearchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>BUG名称</label> 
				<input name="name" v-model="searchForm.name" type="text" placeholder="" class="form-control">
			</div>
			<button type="button" class="btn btn-info pull-right m-t-n-xs" v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
				<div class="btn-group " id="pmpProjectBugsTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 创建BUG
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 修改BUG
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 指派BUG
					</button>
				
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改版本
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 添加工时
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 截止日期
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="deletex">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 删除BUG
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 提交修改
					</button>
					
				</div>
				<table id="pmpProjectBugsBootstrapTable" data-mobile-responsive="true"></table>
	</div>
</div>
<script>
    
new Vue({  
	  el: '#biz_pmpProject_detail_bugs_conatainer',
	  data:{
		  searchForm:{
			  name: null,
			  pmUserId: null,
			  pmProjectId : null
		 },
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		  var projectId="3";
		 _this.searchForm.projectId=projectId;
		  _this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
  		  var columns=[
  			{checkbox:true},
				{field:'bug_name',title:'名称',width:160,sortable:true},
			    {field:'bug_from',title:'来源于需求',width:60,formatter:_this.formatFromType},
			    {field:'bug_detail',title:'详情',width:100},
				{field:'charge_user_name',title:'负责人',width:100},
				{field:'difficulty_score',title:'难度',width:100},
				{field:'priority',title:'优先级',width:100,formatter:_this.formatPriority},
				{field:'severity',title:'严重程度',width:100,formatter:_this.formatSeverity},
				{field:'frequency',title:'出现频率',width:100,formatter:_this.formatFrequency},
				{field:'deduce_score',title:'扣分',width:100},
				{field:'expiry_time',title:'截止时间',width:100},
				{field:'expired',title:'是否延期',width:100,formatter:_this.formatExpired},
				{field:'assign_hours',title:'指派时间',width:100},
				{field:'work_hours',title:'工作时间',width:100},
				{field:'progress',title:'进度',width:100},
				{field:'status',title:'状态',width:100,formatter:_this.formatStatus}];
  		var url="/pmp/service/pm/pmpBugs/loadPmpBugsDataSet";
		zfesBstable.laodTable($("#pmpBugsBootstrapTable"),$("#searchForm"),$("#pmpBugsTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpBugsBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpBugsBootstrapTable"));
  	  },
  	  add:function(){
  		  var　_this=this;
  		 var url="/views/pmpBugs/pmpBugs.add.html";
  		 zfesLayerEditDg.open(url,{},"创建项目",460,function(){_this.refresh();});
  		 
  	  },
  	 /* edit:function(){
  		  if(zfesBstable.isOneRow($("#pmpBugsBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
  			  var url="/views/pmpProject/pmpProject.edit.html";
  			  zfesLayerEditDg.open(url,{"id":id},"项目信息编辑",460,function(){_this.refresh();}); 
  		 }
  	  },*/
  	  deletex: function(){
  			if(zfesBstable.isSelectedRow($("#pmpBugsBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该项目",function(){
  						    var ajaxUrl = "/pmp/service/ma/pmpProject/setPmpProjectStatus";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id,"status":-1}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
      formatFromType:function(value, row, index){
  		if("1"==value){return '[任务]';}else if("2"==value){return '[需求]';}else if("3"==value){return '[bug]';}else {return '[其他]';}
  	},
  	formatFrequency:function(value, row, index){
  		if("1"==value){return '[随机]]';}else{return '[总是]';}
  	},
  	formatExpired:function(value, row, index){
  		if("1"==value){return '[正常]]';}else{return '[已超时]';}
  	},
  	formatSeverity:function(value, row, index){
  		if("1"==value){return '[轻微]';}else if("2"==value){return '[小调整]';}else if("3"==value){return '[中等]';}
  		else if("4"==value){return '[严重]';}else if("5"==value){return '[非常严重]';}else {return '[宕机]';}
  	},
  	formatPriority:function(value, row, index){
  		if("1"==value){return '[低]';}else if("2"==value){return '[中等]';}else if("3"==value){return '[急]';}else{return '[加急]';}
  	},
  	 formatStatus:function(value, row, index){
  		if("1"==value){return '[未指派]';}else if("2"==value){return '[带解决]';}else if("3"==value){return '[进行中]';}
  		else if("4"==value){return '[修改并提交]';}else if("5"==value){return '[测试验收]';}else if("6"==value){return '[测试驳回]';}
  		else if("7"==value){return '[经理驳回]';}else if("8"==value){return '[已完成]';}else if("9"==value){return '[延期处理]';}
  		else if("10"==value){return '[取消]';}else{return '[已删除]';}
  	}

   }
});


</script>


